﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Input;

namespace LNUGame.View
{
    class MenuInputHandler
    {
        private KeyboardState m_currentKeyboardState;
        private KeyboardState m_lastKeyboardState;

        public enum UserInput
        {
            NOTHING = 0,
            CHOOSE_CURRENT = 1,
            MOVE_UP = 2,
            MOVE_DOWN = 3
        }

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        internal UserInput GetUserInput()
        {
            m_currentKeyboardState = Keyboard.GetState();

            UserInput userInput = UserInput.NOTHING;

            if ((m_lastKeyboardState.IsKeyDown(Keys.Enter)) && (m_currentKeyboardState.IsKeyUp(Keys.Enter)))
            {
                userInput = UserInput.CHOOSE_CURRENT;
            }
            else if (m_lastKeyboardState.IsKeyDown(Keys.Up) && m_currentKeyboardState.IsKeyUp(Keys.Up))
            {
                userInput = UserInput.MOVE_UP;
            }
            else if (m_lastKeyboardState.IsKeyDown(Keys.Down) && m_currentKeyboardState.IsKeyUp(Keys.Down))
            {
                userInput = UserInput.MOVE_DOWN;
            }

            m_lastKeyboardState = m_currentKeyboardState;

            return userInput;
        }
    }
}
